<script setup>
import MyCodeEdit from "./MyCodeEdit.vue";
import LineDom from "./LineDom.vue";
import api from "../api";
import CodeEdit2 from "./CodeEdit2.vue";

const code = ref(`根据一个表格计算今年进出仓货值
    打开一个表格
    根据“货值=货物数量乘以货物单价”增加数据列`)


function handelReady(callback) {
  const state = ref()
  callback(h(LineDom), state)

}
function addCode(code){
  api.add.addCode(code)
}
</script>

<template>
  <div class="code-edit">
    <div class="code-menu">
      <n-button class="no-drag" >代码库1</n-button>
      <n-button class="no-drag">代码库2</n-button>
      <n-button class="no-drag">代码库1</n-button>
      <n-button class="no-drag">代码库2</n-button>
      <n-button class="no-drag">代码库1</n-button>
      <n-button class="no-drag" @click="addCode(code)">上传</n-button>
    </div>
    <div class="code-content no-drag">
      <MyCodeEdit v-model="code"
      />
<!--      <CodeEdit2 :code="code" style="-webkit-user-select: text;"/>-->
    </div>
  </div>

</template>

<style scoped>
.input {
  margin: 0;
  padding: 0;
  max-height: 98%;
}

.code-edit {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.code-menu {
  width: 100px;
}

.code-content {
  width: 100%;
  height: 100%;
  overflow: scroll;
  border: 1px solid #ccc;
  overflow-x: hidden;
}
</style>